package cn.edu.ctbu.datajpa01.service;

import cn.edu.ctbu.datajpa01.domain.Teacher;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public interface TeacherService {
    List<Teacher> findAll();

    /**
     * 只分页的查询
     * @param pageable
     * @return
     */
    Page<Teacher> findAll(Pageable pageable);

    /**
     * 按id进行查询 @param id 主键，整数
     * @return
     */
    Teacher findById(Integer id);

    List<Teacher> findByTname(String tname);

    Teacher getById(Integer id);

    Teacher insert(Teacher teacher);

    Teacher update(Teacher teacher);

    void delete(Teacher teacher);

    void delete(Integer id);


    /**
     * 分页，带过滤的查询
     * @param teacher
     * @param pageable
     * @return
     */
    public Page<Teacher> findAll(Example<Teacher> teacher, Pageable pageable);

    public List<Teacher> findByTnoAndPassword(String tno, String password);   //教师工号，密码登录

}
